home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1992 June: ROMin Holiday / ADC Developer CD (1992-06) (''ROMin Holiday'')_iso / Developer Connection - 06-1992.iso / Developer Essentials / MPW Interfaces & Libraries / PInterfaces / ADSP.p next >
Encoding:
Text File  |  1992-01-29  |  7.0 KB  |  188 lines  |  [TEXT/MPS ]

  1.  
  2. {
  3. Created: Sunday, September 15, 1991 at 9:36 PM
  4.  ADSP.p
  5.  Pascal Interface to the Macintosh Libraries
  6.  
  7.   Copyright Apple Computer, Inc. 1986-1991
  8.   All rights reserved
  9. }
  10.  
  11.  
  12. {$IFC UNDEFINED UsingIncludes}
  13. {$SETC UsingIncludes := 0}
  14. {$ENDC}
  15.  
  16. {$IFC NOT UsingIncludes}
  17.  UNIT ADSP;
  18.  INTERFACE
  19. {$ENDC}
  20.  
  21. {$IFC UNDEFINED UsingADSP}
  22. {$SETC UsingADSP := 1}
  23.  
  24. {$I+}
  25. {$SETC ADSPIncludes := UsingIncludes}
  26. {$SETC UsingIncludes := 1}
  27. {$IFC UNDEFINED UsingAppleTalk}
  28. {$I $$Shell(PInterfaces)AppleTalk.p}
  29. {$ENDC}
  30. {$SETC UsingIncludes := ADSPIncludes}
  31.  
  32. CONST
  33.  
  34. { driver control ioResults }
  35. errRefNum = -1280;                            { bad connection refNum }
  36. errAborted = -1279;                            { control call was aborted }
  37. errState = -1278;                            { bad connection state for this operation }
  38. errOpening = -1277;                            { open connection request failed }
  39. errAttention = -1276;                        { attention message too long }
  40. errFwdReset = -1275;                        { read terminated by forward reset }
  41. errDSPQueueSize = -1274;                    { DSP Read/Write Queue Too small }
  42. errOpenDenied = -1273;                        { open connection request was denied }
  43.  
  44. {driver control csCodes}
  45. dspInit = 255;                                { create a new connection end }
  46. dspRemove = 254;                            { remove a connection end }
  47. dspOpen = 253;                                { open a connection }
  48. dspClose = 252;                                { close a connection }
  49. dspCLInit = 251;                            { create a connection listener }
  50. dspCLRemove = 250;                            { remove a connection listener }
  51. dspCLListen = 249;                            { post a listener request }
  52. dspCLDeny = 248;                            { deny an open connection request }
  53. dspStatus = 247;                            { get status of connection end }
  54. dspRead = 246;                                { read data from the connection }
  55. dspWrite = 245;                                { write data on the connection }
  56. dspAttention = 244;                            { send an attention message }
  57. dspOptions = 243;                            { set connection end options }
  58. dspReset = 242;                                { forward reset the connection }
  59. dspNewCID = 241;                            { generate a cid for a connection end }
  60.  
  61. { connection opening modes }
  62. ocRequest = 1;                                { request a connection with remote }
  63. ocPassive = 2;                                { wait for a connection request from remote }
  64. ocAccept = 3;                                { accept request as delivered by listener }
  65. ocEstablish = 4;                            { consider connection to be open }
  66.  
  67. { connection end states }
  68. sListening = 1;                                { for connection listeners }
  69. sPassive = 2;                                { waiting for a connection request from remote }
  70. sOpening = 3;                                { requesting a connection with remote }
  71. sOpen = 4;                                    { connection is open }
  72. sClosing = 5;                                { connection is being torn down }
  73. sClosed = 6;                                { connection end state is closed }
  74.  
  75. { client event flags }
  76. eClosed = $80;                                { received connection closed advice }
  77. eTearDown = $40;                            { connection closed due to broken connection }
  78. eAttention = $20;                            { received attention message }
  79. eFwdReset = $10;                            { received forward reset advice }
  80.  
  81. { miscellaneous constants }
  82. attnBufSize = 570;                            { size of client attention buffer }
  83. minDSPQueueSize = 100;                        { Minimum size of receive or send Queue }
  84.  
  85. TYPE
  86. { connection control block }
  87. TPCCB = ^TRCCB;
  88. TRCCB = PACKED RECORD
  89.  ccbLink: TPCCB;                            { link to next ccb }
  90.  refNum: INTEGER;                            { user reference number }
  91.  state: INTEGER;                            { state of the connection end }
  92.  userFlags: Byte;                            { flags for unsolicited connection events }
  93.  localSocket: Byte;                            { socket number of this connection end }
  94.  remoteAddress: AddrBlock;                    { internet address of remote end }
  95.  attnCode: INTEGER;                            { attention code received }
  96.  attnSize: INTEGER;                            { size of received attention data }
  97.  attnPtr: Ptr;                                { ptr to received attention data }
  98.  reserved: PACKED ARRAY [1..220] OF Byte;    { adsp internal use }
  99.  END;
  100.  
  101. { ADSP CntrlParam ioQElement , driver control call parameter block}
  102. DSPPBPtr = ^DSPParamBlock;
  103. DSPParamBlock = PACKED RECORD
  104.  qLink: QElemPtr;
  105.  qType: INTEGER;
  106.  ioTrap: INTEGER;
  107.  ioCmdAddr: Ptr;
  108.  ioCompletion: ProcPtr;
  109.  ioResult: OSErr;
  110.  ioNamePtr: StringPtr;
  111.  ioVRefNum: INTEGER;
  112.  ioCRefNum: INTEGER;                        { adsp driver refNum }
  113.  csCode: INTEGER;                            { adsp driver control code }
  114.  qStatus: LONGINT;                            { adsp internal use }
  115.  ccbRefNum: INTEGER;                        { refnum of ccb }
  116.  CASE INTEGER OF
  117.    dspInit,dspCLInit:
  118.   (ccbPtr: TPCCB;                            {pointer to connection control block}
  119.    userRoutine: ProcPtr;                    {client routine to call on event}
  120.    sendQSize: INTEGER;                        {size of send queue (0..64K bytes)}
  121.    sendQueue:  Ptr;                            {client passed send queue buffer}
  122.    recvQSize: INTEGER;                        {size of receive queue (0..64K bytes)}
  123.    recvQueue: Ptr;                            {client passed receive queue buffer}
  124.    attnPtr: Ptr;                            {client passed receive attention buffer}
  125.    localSocket: Byte;                        {local socket number}
  126.    filler1: Byte;                            {filler for proper byte alignment}
  127.     );
  128.     dspOpen,dspCLListen,dspCLDeny:
  129.    (localCID: INTEGER;                        {local connection id}
  130.     remoteCID: INTEGER;                        {remote connection id}
  131.     remoteAddress: AddrBlock;                {address of remote end}
  132.     filterAddress: AddrBlock;                {address filter}
  133.     sendSeq: LONGINT;                        {local send sequence number}
  134.     sendWindow: INTEGER;                    {send window size}
  135.     recvSeq: LONGINT;                        {receive sequence number}
  136.     attnSendSeq: LONGINT;                    {attention send sequence number}
  137.     attnRecvSeq: LONGINT;                    {attention receive sequence number}
  138.     ocMode: Byte;                            {open connection mode}
  139.     ocInterval: Byte;                        {open connection request retry interval}
  140.     ocMaximum: Byte;                        {open connection request retry maximum}
  141.     filler2: Byte;                            {filler for proper byte alignment}
  142.      );
  143.      dspClose,dspRemove:
  144.     (abort: Byte;                            {abort connection immediately if non-zero}
  145.      filler3: Byte;                            {filler for proper byte alignment}
  146.       );
  147.       dspStatus:
  148.      (statusCCB: TPCCB;                        {pointer to ccb}
  149.       sendQPending: INTEGER;                {pending bytes in send queue}
  150.       sendQFree: INTEGER;                    {available buffer space in send queue}
  151.       recvQPending: INTEGER;                {pending bytes in receive queue}
  152.       recvQFree: INTEGER;                    {available buffer space in receive queue}
  153.        );
  154.        dspRead,dspWrite:
  155.       (reqCount: INTEGER;                    {requested number of bytes}
  156.        actCount: INTEGER;                    {actual number of bytes}
  157.        dataPtr: Ptr;                        {pointer to data buffer}
  158.        eom: Byte;                            {indicates logical end of message}
  159.        flush: Byte;                            {send data now}
  160.         );
  161.         dspAttention:
  162.        (attnCode: INTEGER;                    {client attention code}
  163.         attnSize: INTEGER;                    {size of attention data}
  164.         attnData: Ptr;                        {pointer to attention data}
  165.         attnInterval: Byte;                    {retransmit timer in 10-tick intervals}
  166.         filler4: Byte;                        {filler for proper byte alignment}
  167.          );
  168.          dspOptions:
  169.         (sendBlocking: INTEGER;                {quantum for data packets}
  170.          sendTimer: Byte;                    {send timer in 10-tick intervals}
  171.          rtmtTimer: Byte;                    {retransmit timer in 10-tick intervals}
  172.          badSeqMax: Byte;                    {threshold for sending retransmit advice}
  173.          useCheckSum: Byte;                    {use ddp packet checksum}
  174.           );
  175.           dspNewCID:
  176.          (newCID: INTEGER;                    {new connection id returned}
  177.            );
  178.  END;
  179.  
  180.  
  181.  
  182. {$ENDC} { UsingADSP }
  183.  
  184. {$IFC NOT UsingIncludes}
  185.  END.
  186. {$ENDC}
  187.  
  188.